home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.c++,
- Path: in2.uu.net!edg1!jsa
- From: jsa@edg.com (J. Stephen Adamczyk)
- Subject: Re: g++ 2.5.8 -> 2.7.0 Syntax Error
- Message-ID: <Dp15zu.It9@edg.com>
- Organization: Edison Design Group Inc.
- References: <boyseDozKHC.JyA@netcom.com> <4jfhmc$b72@news1.h1.usa.pipeline.com>
- Date: Fri, 29 Mar 1996 13:11:53 GMT
-
- In article <4jfhmc$b72@news1.h1.usa.pipeline.com> grantp@usa.pipeline.com(Pete Grant) writes:
- >On Mar 28, 1996 16:29:35 in article <g++ 2.5.8 -> 2.7.0 Syntax Error>,
- >'boyse@netcom.com (William Boyse)' wrote:
- >>Element *Next_Element(Element *ptr_elt)
- >>{
- >>ptr_elt = new Tri_6(); // ******* THIS IS THE OFFENDING LINE ********
- >
- >Omit the parentheses. When constructing a class without
- >passing any parameters, the parentheses are not appropriate.
-
- The parentheses are not required, but there's nothing wrong with using them.
- The real problem in this example is that "Tri_6" is both a class name and
- an enumeration constant name:
-
- >enum Elt_Type {None, Tri_3, Tri_6, Quad_4, Tet_4};
- >class Tri_6 : public Element
-
- In the absence of an elaborated type specifier, the compiler is correct in
- choosing the enumeration constant, and then giving an error because it's
- not a type. Try
-
- ptr_elt = new class Tri_6;
-
- (I don't know if g++ 2.7.0 will accept it, but it is valid C++.)
-
- Steve Adamczyk
- Edison Design Group
-
-